/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.sole.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author bala
 */
@Entity
@Table(name = "tutorias")
@XmlRootElement
@NamedQueries({
  @NamedQuery(name = "Tutoria.findAll", query = "SELECT t FROM Tutoria t WHERE t.activo=TRUE"),
  @NamedQuery(name = "Tutoria.findById", query = "SELECT t FROM Tutoria t WHERE t.id = :id and t.activo=TRUE"),
  @NamedQuery(name = "Tutoria.findByDescripcion", query = "SELECT t FROM Tutoria t WHERE t.tipoPrecio = :tipo_precio and t.activo=TRUE")})

public class Tutoria implements Serializable {

  private static final long serialVersionUID = 1L;
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Basic(optional = false)
  @Column(nullable = false)
  private Integer id;
  @JoinColumn(name = "materia", referencedColumnName = "id", nullable = false)
 @ManyToOne(optional = false)
  private Materia materia;
  @Basic(optional = false)
  @Column(name = "tipo_precio", nullable = false, length = 255)
  private String tipoPrecio;
  @Basic(optional = false)
  @Column(name = "precio_tutoria", nullable = false)
  private Integer precioTutoria;
  @Basic(optional = false)
  @Column(name = "costo_tutoria", nullable = false)
  private Integer costoTutoria;
  private Boolean activo;

  public Tutoria() {
  }

  public Tutoria(Integer id) {
    this.id = id;
  }

  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public Materia getMateria() {
    return materia;
  }

  public void setMateria(Materia materia) {
    this.materia = materia;
  }

  public String getTipoPrecio() {
    return tipoPrecio;
  }

  public void setTipoPrecio(String tipoPrecio) {
    this.tipoPrecio = tipoPrecio;
  }

  public Integer getPrecioTutoria() {
    return precioTutoria;
  }

  public void setPrecioTutoria(Integer precioTutoria) {
    this.precioTutoria = precioTutoria;
  }

  public Integer getCostoTutoria() {
    return costoTutoria;
  }

  public void setCostoTutoria(Integer costoTutoria) {
    this.costoTutoria = costoTutoria;
  }

  public Boolean isActivo() {
    return activo;
  }

  public void setActivo(Boolean activo) {
    this.activo = activo;
  }

  @Override
  public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof Tutoria)) {
      return false;
    }
    Tutoria other = (Tutoria) object;
    if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "py.com.sole.model.Tutoria[ id=" + id + " ]";
  }
}
